﻿#include "roleservice.h"

#include <coredatabase.h>

RoleService::RoleService(QObject *parent) : QObject(parent)
{
    db = CoreDatabase::getInstance()->getConnection();
}

RoleService::~RoleService()
{
    CoreDatabase::getInstance()->releaseConnection(db);
}

bool RoleService::getPageList(uint64_t &total, QList<Role> &users, const uint64_t &page, const uint64_t &pageSize)
{
    RoleDao objectDao(db);
    return (objectDao.getTotalByParam(total) && objectDao.getPageListByParam(users,page,pageSize));
}


bool RoleService::getList(QList<Role> &list)
{
    RoleDao objectDao(db);
    return (objectDao.getList(list));
}

bool RoleService::getOne(Role &object)
{
    RoleDao objectDao(db);
    return (objectDao.getOne(object));
}

bool RoleService::saveOne(Role &object)
{
    RoleDao objectDao(db);
    return (objectDao.saveOne(object));
}

bool RoleService::deleteOne(Role &object)
{
    RoleDao objectDao(db);
    return (objectDao.deleteOne(object));
}

